import request from '@/utils/request.js'
// axios 根路径 封装在utils里面的request.js
// 请求头数据 封装在utils里面的request.js里面的请求拦截器interceptor
//用户认证（登录注册）
export const login = data => {
    return request({
        method: 'POST',
        url: '/v1_0/authorizations',
        data
    })
}
// 发送短信验证码
export const getSmsCode = mobile => {
    return request({
        method: 'GET',
        url: `/v1_0/sms/codes/${mobile}`
    })
}
//获取用户个人资料
export const getUserInfo = () => {
    return request({
        method: 'GET',
        url: '/v1_0/user',
    })
}
// 获取用户的频道列表
export const getUserChannels = () => {
    return request({
        method: 'GET',
        url: '/v1_0/user/channels'
    })
}

// 获取点击添加关注的接口
export const addFollow = userId => {
    return request({
        method: 'POST',
        url: '/v1_0/user/followings',
        data: {
            target: userId
        }
    })
}
// 获取点击取消关注的接口
export const deleteFollow = userId => {
    return request({
        method: 'DELETE',
        url: `/v1_0/user/followings/${userId}`
    })
}
// 获取用户个人资料
export const getUserProfile = () => {
    return request({
        method: 'GET',
        url: '/v1_0/user/profile'
    })
}
// 更新用户个人资料
export const updateUserProfile = data => {
    return request({
        method: 'PATCH',
        url: '/v1_0/user/profile',
        data
    })
}
// 更新头像
export const updateUserAvatar = data => {
    return request({
        method: 'PATCH',
        url: '/v1_0/user/photo',
        data
    })
}